<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/include/background.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>自动导航添加页面</title>
<link rel="stylesheet" type="text/css" href="<%=css%>/common.css"/>
<link rel="stylesheet" type="text/css" href="<%=css%>/main.css"/>
<script>
$(document).ready(function(){
	//保存按钮
	$("#saveButton").click(function() {
		var name = $("#name").val();
		var norder = $("#norder").val();
		var tolink = $("#tolink").val();
		var targettype = $("input[name='targettype']:checked").val();
		//ajax提交
		$.ajax({
			url : "<%=pre%>/b_navcustom/insert<%=suf%>",
			type : 'post',
			dataType : 'html',
			data : {name:name,norder:norder,tolink:tolink,targettype:targettype},
			success : function(data, status) {
				if (status == 'success') {
					if (data == '1') {
						var timer;
						art.dialog({
							content : '<span style="color:#f00">插入成功！</span>',
							init : function() {
								var that = this, i = 1;
								var fn = function() {
									!i && that.close();
									i--;
								};
								timer = setInterval(fn, 1000);
								fn();
							},
							close : function() {
								clearInterval(timer);
								window.location.href="<%=pre%>/b_navcustom/index<%=suf%>";
							}
						}).show();	
					} else {
						art.dialog.tips('<span style="color:#f00">插入失败！</span>', 1);
					}
				}
			},
			error : function(xhr, textStatus,
					errorThrown) {
				art.dialog.tips('<span style="color:#f00">插入失败！</span>', 1);
			}
		});
		
	});
});
</script>
</head>
<body>
<div class="crumb-wrap">
	<div class="crumb-list">
		<i class="icon-font"></i>
		<a href="index.html">首页</a>
		<span class="crumb-step">&gt;</span>
		<span class="crumb-name">自定义导航管理</span>
		<span class="crumb-step">&gt;</span>
		<span class="crumb-name">导航添加</span>
	</div>
</div>
<div class="result-wrap">
	<div class="result-content">
		<table class="insert-tab" width="100%">
			<tr>
				<td width="200px">导航名称：</td>
				<td><input type="text" name="name" id="name"></td>
			</tr>
			<tr>
				<td>跳转到的链接：</td>
				<td><input type="text" name="tolink" id="tolink" style="width:80%"></td>
			</tr>
			<tr>
				<td>显示顺序：</td>
				<td><input type="text" name="norder" id="norder"></td>
			</tr>
			<tr>
				<td>跳转方式：</td>
				<td>
					<input type="radio" name="targettype" value="1" checked="true">新页面
					<input type="radio" name="targettype" value="2">原始页面
				</td>
			</tr>
			<tr>
				<td>
					<input type="submit" value="保存" class="button" id="saveButton" />
					<a href="<%=pre%>/b_navcustom/index<%=suf%>" style="padding-left:10px">返回</a>
				</td>
				<td>
				</td>
			</tr>
		</table>
	</div>
</div>
</body>
</html>